<script src="../lib/jquery.js"></script>
<script>
$(function(){
	// Storing and retrieving data related to an element.	 
	$( "#myDiv" ).data( "keyName", { foo: "bar" } );	 
	console.log($( "#myDiv" ).data( "keyName" )); // Returns { foo: "bar" }
	
	
	// Storing a relationship between elements using .data()	 
	$( "#myList li" ).each(function() {	 
	    var li = $( this );
	    var div = li.find( "div.content" );	 
	    li.data( "contentDiv", div );	    
	});
	 
	// Later, we don't have to find the div again;
	// we can just read it from the list item's data
	var firstLi = $( "#myList li:first" );	
	firstLi.data( "contentDiv" ).html( "new content" );
});
</script>

<div id="myDiv">
	<ul id="myList">
		<li><div class="content">0</div></li>
		<li><div class="content">1</div></li>
	</ul>
</div>